package com.tl.web.controller.app;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tl.common.annotation.Log;
import com.tl.common.core.controller.BaseController;
import com.tl.common.core.domain.AjaxResult;
import com.tl.common.enums.BusinessType;
import com.tl.app.domain.AppGradeUserLog;
import com.tl.app.service.IAppGradeUserLogService;
import com.tl.common.utils.poi.ExcelUtil;
import com.tl.common.core.page.TableDataInfo;

/**
 * 升级等级记录Controller
 * 
 * @author suhp
 * @date 2024-07-07
 */
@RestController
@RequestMapping("/app/gradeUserLog")
public class AppGradeUserLogController extends BaseController
{
    @Autowired
    private IAppGradeUserLogService appGradeUserLogService;

    /**
     * 查询升级等级记录列表
     */
    @GetMapping("/list")
    public TableDataInfo list(AppGradeUserLog appGradeUserLog)
    {
        startPage();
        List<AppGradeUserLog> list = appGradeUserLogService.selectAppGradeUserLogList(appGradeUserLog);
        return getDataTable(list);
    }

    /**
     * 导出升级等级记录列表
     */
    @Log(title = "升级等级记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, AppGradeUserLog appGradeUserLog)
    {
        List<AppGradeUserLog> list = appGradeUserLogService.selectAppGradeUserLogList(appGradeUserLog);
        ExcelUtil<AppGradeUserLog> util = new ExcelUtil<AppGradeUserLog>(AppGradeUserLog.class);
        util.exportExcel(response, list, "升级等级记录数据");
    }

    /**
     * 获取升级等级记录详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(appGradeUserLogService.selectAppGradeUserLogById(id));
    }

    /**
     * 新增升级等级记录
     */
    @Log(title = "升级等级记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody AppGradeUserLog appGradeUserLog)
    {
        return toAjax(appGradeUserLogService.insertAppGradeUserLog(appGradeUserLog));
    }

    /**
     * 修改升级等级记录
     */
    @Log(title = "升级等级记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody AppGradeUserLog appGradeUserLog)
    {
        return toAjax(appGradeUserLogService.updateAppGradeUserLog(appGradeUserLog));
    }

    /**
     * 删除升级等级记录
     */
    @Log(title = "升级等级记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(appGradeUserLogService.deleteAppGradeUserLogByIds(ids));
    }
}
